from flask_login import UserMixin
from __init__ import login_manager

# 假设的用户存储
users = {'admin': {'admin': '123456'}}


# 用户类
class User(UserMixin):
    def __init__(self, id):
        self.id = id

    def __repr__(self):
        return "%d" % self.id


# 用户加载函数
@login_manager.user_loader
def load_user(user_id):
    if user_id in users:
        return User(user_id)
    return None
